<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="utf-8">
<head>
<title></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link href="<?php echo base_url()?>css/general.css" rel="stylesheet" type="text/css" />
<link href="<?php echo base_url()?>css/main.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="<?php echo base_url()?>js/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo base_url()?>js/jquery.js"></script>
<script language="JavaScript"> var base_url = '<?php echo base_url()?>'; </script>
<script language="javascript" type="text/javascript" src="<?php echo base_url()?>js/admin.js"></script>

<script language="JavaScript"> 
<!--

//列表窗口缩放效果
$(document).ready(function() {
  listBody();
});
$(window).resize(function(){
  listBody();
});
 
$(document).ready(function() {
  $('#search-action').click(function(){
   $.post('<?php echo site_url('shipping_list')?>', $('#search-form').serialize(), function(data) {
	  $('.x-grid3-row').remove();
	  $('#page').remove();
	  $('.x-grid3-row',data).appendTo($('#listTable tbody'));	  
	  $('#page',data).appendTo($('#content'));

	  pageStyle();
	  pageClick()
	  $('#listTable').alternateRowColors().eventRowColors();
    });
  });

});

function del(id,obj)
{
	if (confirm('确定把该订单删除吗？')){
 
	window.location.href= '<?php echo site_url('shipping_list/delete/id')?>'+'/'+id;
    }
}

function listToggle(obj, field, id)
{
	var val = (obj.src.match(/yes.gif/i)) ? 0 : 1;

	$.ajax({
    url: '<?php echo site_url('shipping_list/list_toggle')?>/field/'+field+'/id/'+id+'/val/'+val,
    type: 'POST',
    dataType: 'html',
    success: function(data){	
	  obj.src = (data > 0) ? '<?php echo base_url()?>images/yes.gif' : '<?php echo base_url()?>images/no.gif';
    }
  });
}


function listEdit(obj, field, id)
{
  var tag = obj.firstChild.tagName;

  if (typeof(tag) != "undefined" && tag.toLowerCase() == "input")
  {
    return;
  }

  /* 保存原始的内容 */
  var org = $(obj).html();
  var val = $(obj).text();

  /* 创建一个输入框 */
  var txt = $('<input/>');
  (val == 'N/A') ? txt.val('') : txt.val(val);
  txt.css('width',$(obj).outerWidth()+50+'px');

  /* 隐藏对象中的内容，并将输入框加入到对象中 */
  $(obj).html('');
  $(obj).append(txt);
  txt.focus();

  /* 编辑区输入事件处理函数 */
  txt.keypress(function(event){
    if (event.which == 13){
		$(txt).blur();
		return false;
	}

	if (event.which == 27){
		txt.parent().html(org);
	}
  });

  /* 编辑区失去焦点的处理函数 */
  txt.blur(function(){
    if ($(this).val() != ''){
      $.ajax({
		url: '<?php echo site_url('shipping_list/list_toggle')?>/field/'+field+'/id/'+id+'/val/'+encodeURIComponent($(this).val()),
		type: 'GET',
		dataType: 'html',
		success: function(data){
			//alert(data);
		  $(obj).html(data);
		}
	  });
	}else{
      $(obj).html(org);
	}
    
  });
}
 //--> 
</script>

</head>

<body  class=" x-border-layout-ct" style="position: relative;" >
<div id="msg"></div>
<div id="main-tabs" class="x-tab-panel x-border-panel" style="left: 5px; top: 0px;">

  <div  id="crt-menu" class="x-tab-panel-header x-unselectable">
  <div  id="crt-menu1" class="x-tab-strip-wrap">
  <ul id="crt-menu2" class="x-tab-strip x-tab-strip-top">
  <li class="x-tab-strip-active" >
  <a class="x-tab-right" href="#" onClick="return false;">
  <em class="x-tab-left">
  <span style="width: 130px;" class="x-tab-strip-inner">
  <span class="x-tab-strip-text">托运单列表</span>
  </span>
  </em>
  </a>
  </li>
  <li  class="x-tab-edge"></li>
  <div  class="x-clear"></div>
  </ul>
  </div>
  </div>
  
  <!-- 菜单体 -->
  <div class="x-tab-panel-bwrap border-bottom x-panel-body" >
  <div id="menu-body1" class="x-tab-panel-body x-tab-panel-body-top" >
  <div id="menu-body2" class="x-panel x-panel-noborder" >
  <div  class="x-panel-bwrap">
  <div id="menu-body" class="x-panel-body x-panel-body-noheader x-panel-body-noborder x-border-layout-ct" style="">
  <div id="menu-body3" class="x-panel x-border-panel x-grid-panel" style="left: 0px; top: 0px;">
  <div style="position: relative;"  class="x-panel-bwrap">

      <!-- 工具栏 -->
      <div id="tool" class="x-panel-tbar x-panel-tbar-noheader "><div  class="x-toolbar " style="border-left:0 solid #99bbe8;"><table cellspacing="0"><tbody><tr>
	
	  <td  onClick="window.location.href='<?php echo site_url('shipping_list/add')?>'"><table style="width: hidden;"  class="button x-btn-wrap x-btn x-btn-text-icon " border="0" cellpadding="0" cellspacing="0" ><tbody><tr>
	  <td class="x-btn-left"><i>&nbsp;</i></td>
	  <td class="x-btn-center" ><em ><button  class="x-btn-text tb-addnew" type="button" >收货录入</button></em></td>
	  <td class="x-btn-right"><i></i></td>
	  </tr></tbody></table></td>
      	<td><span class="ytb-sep"></span></td>
	<!--<td id="saveEdit"><table class="x-btn-wrap x-btn x-btn-text-icon button" border="0" cellpadding="0" cellspacing="0" ><tbody><tr><td class="x-btn-left"><i>&nbsp;</i></td><td class="x-btn-center"><em ><button class="x-btn-text tb-renew" type="button">打印货运单</button></em></td><td class="x-btn-right"><i>&nbsp;</i></td></tr></tbody></table></td>-->


	  </tr></tbody></table></div>
	  

	  </div>
	  <!-- /工具栏 -->

	  <!-- 搜索栏 -->
	  <div id="search" class="x-panel-bbar x-panel-body" style="border-left:0 solid #99bbe8; border-bottom:0 solid #99bbe8;" >
	  <div  class="x-toolbar x-small-editor" style=" padding:2px 0 5px 20px; height:auto;">
	  <form id="search-form" style="overflow:;">
      托运日期：		  <input style="width:122px; background-color:#FCFBDF;"   size="16"  class="x-form-text x-form-field Wdate" name="st" id="st" type="text"     readonly="readonly" onFocus="WdatePicker({el:'st',dateFmt:'yyyy年MM月dd日' })"  >
		  
		到
		  <input style="width:122px; background-color:#FCFBDF;"   size="16"  class="x-form-text x-form-field  Wdate" name="et" id="et" type="text"     readonly="readonly" onFocus="WdatePicker({el:'et',dateFmt:'yyyy年MM月dd日' })"  >&nbsp;&nbsp;发站：
          
        
		  		  <select name='checkin_site'  style="width:122px;height:26px;" class="x-form-field  x-form-text x-form-required">
		   		  <option value='0'  >请选择...</option>
		   <?php foreach($checkedin_site as $value) :  ?>
		  <option value='<?php echo $value['id'];  ?>'><?php echo $value['name'];  ?></option>
		  <?php endforeach; ?>
		  </select>           
          
          到站：
		 		   <select name='destination_site'  style="width:122px;height:26px;" class="x-form-field  x-form-text x-form-required">
		 		  <option value='0'  >请选择...</option>
           <?php foreach($destination_site as $value) :  ?>
		  <option value='<?php echo $value['id'];  ?>'  ><?php echo $value['name'];  ?></option>
		  <?php endforeach; ?>
		  </select>          
		  <input name="search"  type="hidden" value="1" />
		  <input id="search_page" name="page"  type="hidden" value="<?php  echo $page;  ?>" />
		  <select name='field'  style="width:130px;height:22px;">
		  <option value='shipping_no'>托运单号</option>
          <option value='shipper'>发货人</option>		  
		  <option value='shipper_telephone'>发货人电话</option>			  
		  <option value='receiver'>收货人</option>
		  <option value='receiver_telephone'>收货人电话</option>
		  <option value='operator'>开票人</option>          

          </select>
		  &nbsp; &nbsp; 
		  关键字 <input type="text" name="keyword" size="20" class="x-form-text x-form-field"  value="<?php echo $keyword; ?>" />
		  &nbsp; &nbsp; &nbsp;
		  <button id="search-action" class="x-btn-text" type="button">搜索</button>
	  </form>
	  
	  </div>
	  </div>
	  <!-- /搜索栏 -->
	  
	  <!-- 内容 -->
	  <div style="border-left:0 solid #99bbe8; border-bottom:0 solid #99bbe8;" id="content" class="x-panel-body" >
	    <div class="list-div " id="listDiv" style="margin-bottom:0px;overflow:auto">	      
		  <table cellpadding="3" cellspacing="0" id="listTable" >		  
          <thead>
		  <tr class="x-grid3-header">
          <th class="sort-numeric " >
			<div class="x-grid3-hd-inner ">选择<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>
			<th class="sort-numeric " >
			<div class="x-grid3-hd-inner ">ID<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>

			<th class="sort-alpha" >
			<div class="x-grid3-hd-inner">托运单号<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>

			<th class="sort-alpha">
			<div class="x-grid3-hd-inner">托运日期<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>

			<th class="sort-alpha">
			<div class="x-grid3-hd-inner">发货人<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>

			<th class="sort-alpha">
			<div class="x-grid3-hd-inner">发货人电话<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>
			<th class="sort-alpha ">
			<div class="x-grid3-hd-inner">收货人<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th >
			
			<th class="sort-alpha">
			<div class="x-grid3-hd-inner">收货人电话<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>
			<th class="sort-alpha">
			<div class="x-grid3-hd-inner">发站<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>
			<th class="sort-alpha">
			<div class="x-grid3-hd-inner">到站<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
			<div class="x-grid3-hd-inner">服务方式<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha"> 
			<div class="x-grid3-hd-inner">付款方式<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
			<div class="x-grid3-hd-inner">货物名称<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
            <div class="x-grid3-hd-inner">货物件数<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
            <div class="x-grid3-hd-inner">货物包数<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha"> 
			<div class="x-grid3-hd-inner">货物价值<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
			<div class="x-grid3-hd-inner">中转站<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
			<div class="x-grid3-hd-inner">运费<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>	
            
            <th class="sort-alpha">
			<div class="x-grid3-hd-inner">送货费<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>				            <th class="sort-alpha">                                                                    
			<div class="x-grid3-hd-inner">代收货款<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">              
			<div class="x-grid3-hd-inner">实际代收货款<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
			<div class="x-grid3-hd-inner">中转费<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
			<div class="x-grid3-hd-inner">开票人<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>					            <th class="sort-alpha">
                                    
			<div class="x-grid3-hd-inner">备注<img class="x-grid3-sort-icon" src="<?php echo base_url()?>images/s.gif"></div></th>
			<th >
			<div class="x-grid3-hd-inner">操作</div></th >
		  </tr>
          </thead>
		  <tbody>
		  <?php  foreach ($shipping_list as $value){ ?>
		  <tr class="x-grid3-row " >
			<td><div class="x-grid3-cell-inner " style=" text-align:center;"><input type="radio"  name="shipping_id[]" value=<?php echo $value['id']?>></div></td>
			<td><div class="x-grid3-cell-inner "><?php echo $value['id'] ?></div></td>
			<td ><div class="x-grid3-cell-inner " ><?php echo $value['shipping_no']; ?></div></td>
			<td><div class="x-grid3-cell-inner "><?php echo $value['operate_datetime'] ?></div></td>
 

			<td ><div class="x-grid3-cell-inner "><?php echo $value['shipper'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner "><?php echo $value['shipper_telephone'] ?></div></td>	
			<td ><div class="x-grid3-cell-inner "><?php echo $value['receiver'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner "><?php echo $value['receiver_telephone'] ?></div></td>	
			<td ><div class="x-grid3-cell-inner "><?php echo $value['checkin_site_name'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner "><?php echo $value['destination_site_name'] ?></div></td>	
			<td ><div class="x-grid3-cell-inner "><?php echo $value['delivery_methmod_name'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner "><?php echo $value['payment_mode_name'] ?></div></td>	
			<td ><div class="x-grid3-cell-inner "><?php echo $value['goods_name'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner "><?php echo $value['goods_num'] ?></div></td>	
			<td ><div class="x-grid3-cell-inner "><?php echo $value['goods_packet_num'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner "><?php echo $value['goods_value'] ?></div></td>	                                                             
			<td ><div class="x-grid3-cell-inner "><?php echo $value['transfer_station'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner "><?php echo $value['freight'] ?></div></td>	
 			<td ><div class="x-grid3-cell-inner "><?php echo $value['v_fee'] ?></div></td>           		
        	<td ><div class="x-grid3-cell-inner "><?php echo $value['cod_fee'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner "><?php echo $value['actual_fee'] ?></div></td>				 		 
			<td ><div class="x-grid3-cell-inner "><?php echo $value['transfer_fee'] ?></div></td>	
			<td ><div class="x-grid3-cell-inner "><?php echo $value['operator_name'] ?></div></td>	
			<td ><div class="x-grid3-cell-inner "><?php echo $value['demo'] ?></div></td>			
			<td ><div class="x-grid3-cell-inner ">
			 
			 <a href='<?php echo site_url('shipping_list/edit/id/'.$value['id'])?>' style="text-decoration:none" alt='编辑' title='编辑'>
			 <img src="<?php echo base_url()?>images/icon_edit.gif" border="0" width="16" height="16">			 </a>&nbsp;&nbsp;
			 <a href='#' id="delete" style="text-decoration:none"  title='删除' onclick="del('<?php echo $value['id']?>',this)">
			 <img src="<?php echo base_url()?>images/icon_drop.gif" border="0" width="16" height="16" alt='删除'>			 </a>&nbsp;&nbsp;
<a href='<?php echo site_url('shipping_list/print_shipping/id/'.$value['shipping_no'])?>'  target="new" id="print" style="text-decoration:none"  title='打印'>
			 <img src="<?php echo base_url()?>images/details.gif" border="0" width="16" height="16" alt='打印货运单'>			 </a>


			</div></td>
		  </tr>
		  <?php  } ?>
		</tbody></table>
		</div>
		<!-- 分页显示 -->
		<?php
		$data['total_pages'] = $total_pages;
		$data['page_first'] = $page_first;
		$data['page_prev'] = $page_prev;
		$data['total_pages'] = $total_pages;
		$data['page'] = $page;
		$data['page_next'] = $page_next;
		$data['page_last'] = $page_last;
		$data['show_start'] = $show_start;
		$data['show_end'] = $show_end;
		$data['total_rows'] = $total_rows;
		$this->load->view('widget/pagination', $data)
	    ?>
		<!-- /分页显示 -->
		</div><!-- /内容 -->	   
  </div></div></div></div></div></div></div>
  <!-- /菜单体 --> 
</div>
</body>
</html>

